﻿using Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;

namespace PublicScreenMenue
{
    public class CmdEntry : IExtensionApplication
    {
        public void Initialize()
        {
            QuckCmdData.ReloadLsp();
            PublicScreenMenue_Plan();
        }

        public void Terminate()
        {
        }
        // 第六章 快捷命令定义
        // QQ群:529711940 大牛,还有gitee代码 不要有中文(命令名称,C#支持中文函数名)
        /// <summary>
        /// </summary>
        [CommandMethod("PublicScreenMenue_QcmdDef")]
        public static void PublicScreenMenue_QcmdDef()
        {
            // 1.有一个ui
            // 2.了解lsp基本语法(网上自己找教程)不想学,直接用咱们教程提到的语法就够用了,这一章
            // 3.界面之前屏幕菜单
            ScreenMenuManager.ShowQuckCmd();

        }
        // 第五章 屏幕菜单
        // QQ群:529711940 大牛,还有gitee代码 不要有中文(命令名称,C#支持中文函数名)
        /// <summary>
        /// </summary>
        [CommandMethod("PublicScreenMenue_Plan")]
        public static void PublicScreenMenue_Plan()
        {
            // 1.xml 配置文件,不限于xml,json 任何 txt
            // 2.UI  各种开源库,网友. HZH_Controls
            // 3.实现菜单UI消息,发送命令就可以了.
            ScreenMenuManager.ShowScreenMenu();
        }
        static System.Windows.Forms.MenuStrip g_menuStrip = null;
        [CommandMethod("PublicScreenMenue_Strip")]
        public static void PublicScreenMenue_Strip()
        {
            if (null == g_menuStrip || g_menuStrip.IsDisposed)
            {
                g_menuStrip = new System.Windows.Forms.MenuStrip();
                g_menuStrip.Items.Add("123");
                g_menuStrip.Items.Add("456");
                g_menuStrip.Parent = System.Windows.Forms.Control.FromHandle(Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle);
            }

            g_menuStrip.Visible = true;
        }
        // XPPanel
        // QQ群:529711940 大牛,还有gitee代码 不要有中文(命令名称,C#支持中文函数名)
        /// <summary>
        /// </summary>
        [CommandMethod("PublicScreenMenue_XPPanel")]
        public static void PublicScreenMenue_XPPanel()
        {
            PublicCtrl.TestClass.ShowXpPanelDlg();
        }
    }
}
